package com.wyl.es.service;

import com.wyl.es.model.NBAPlayer;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author: wyl
 * @date: 2021/8/5
 * @des:
 */
public interface NBAPlayerService {

    /**
     * 添加球员
     *
     * @param player
     * @param id
     * @return
     * @throws IOException
     */
    boolean addPlayer(NBAPlayer player, String id) throws IOException;

    /**
     * 获得球员
     *
     * @param id
     * @return
     * @throws IOException
     */
    Map<String, Object> getPlayer(String id) throws IOException;

    /**
     * 更新球员
     *
     * @param player
     * @param id
     * @return
     * @throws IOException
     */
    boolean updatePlayer(NBAPlayer player, String id) throws IOException;

    /**
     * 删除球员
     *
     * @param id
     * @return
     * @throws IOException
     */
    boolean deletePlayer(String id) throws IOException;

    /**
     * 根据查询条件删除
     *
     * @param key
     * @param value
     * @return
     * @throws IOException
     */
    boolean deleteByQuery(String key, String value) throws IOException;


    /**
     * 删除所有球员
     *
     * @return
     * @throws IOException
     */
    boolean deleteAllPlayer() throws IOException;

    /**
     * 批量导入所有球员
     *
     * @return
     * @throws IOException
     */
    boolean importAll();

    /**
     * 搜索匹配的
     *
     * @param key
     * @param value
     * @return
     * @throws IOException
     */
    List<NBAPlayer> searchMatch(String key, String value) throws IOException;

    /**
     * term查询
     *
     * @param key
     * @param value
     * @return
     * @throws IOException
     */
    List<NBAPlayer> searchTerm(String key, String value) throws IOException;

    /**
     * 前缀查询
     *
     * @param key
     * @param value
     * @return
     * @throws IOException
     */
    List<NBAPlayer> searchMatchPrefix(String key, String value) throws IOException;
}
